package cn.cuilan.jol;

import org.openjdk.jol.info.ClassLayout;
import org.openjdk.jol.info.GraphLayout;
import org.openjdk.jol.vm.VM;

/**
 * JOL查询对象大小
 *
 * @author zhang.yan
 * @since 2021/3/11
 */
public class JolObjectSize {

    public static void main(String[] args) {
        System.out.println(VM.current().details());

        A a = new A();
        ClassLayout layout = ClassLayout.parseInstance(a);
        GraphLayout graphLayout = GraphLayout.parseInstance(a);

        System.out.println(layout.toPrintable());
        System.out.println(graphLayout.toPrintable());
    }

}
